Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
morpheme-match-all
Advanced tools
A wrapper of morpheme-match API. Match all kuromoji's tokens.
kuromojinのtoken同士を比較して、 形態素解析結果を元にしたtoken辞書による比較を行うライブラリです。
Install with npm:
npm install morpheme-match-all
morpheme-match-all compare two kuromoji's tokens using morpheme-match.
You can see kuromoji's tokens at azu.github.io/morpheme-match/.
Define dictionary as tokens
list.
"use strict";
module.exports = [
{
// https://azu.github.io/morpheme-match/?text=解析(することができます)。
message: `"することができる"は有害 http://qiita.com/takahi-i/items/a93dc2ff42af6b93f6e0`,
tokens: [
{
"surface_form": "する",
"pos": "動詞",
"pos_detail_1": "自立",
"pos_detail_2": "*",
"pos_detail_3": "*",
"conjugated_type": "サ変・スル",
"conjugated_form": "基本形",
"basic_form": "する",
"reading": "スル",
"pronunciation": "スル"
},
{
"surface_form": "こと",
"pos": "名詞",
"pos_detail_1": "非自立",
"pos_detail_2": "一般",
"pos_detail_3": "*",
"conjugated_type": "*",
"conjugated_form": "*",
"basic_form": "こと",
"reading": "コト",
"pronunciation": "コト"
},
{
"surface_form": "が",
"pos": "助詞",
"pos_detail_1": "格助詞",
"pos_detail_2": "一般",
"pos_detail_3": "*",
"conjugated_type": "*",
"conjugated_form": "*",
"basic_form": "が",
"reading": "ガ",
"pronunciation": "ガ"
},
{
"pos": "動詞",
"pos_detail_1": "自立",
"conjugated_type": "一段",
"conjugated_form": "連用形",
"basic_form": "できる",
}
]
}
];
morpheme-match-all the actual tokens generated by kuromojin(kuromoji.js).
const kuromojin = require("kuromojin");
const createMatcher = require("morpheme-match-all");
const dictionaries = require("./fixtures/dictionary");
const matchAll = createMatcher(dictionaries);
return kuromojin("解析することができます。").then((actualTokens) => {
const results = matchAll(actualTokens);
/**
[ { tokens: [ [Object], [Object], [Object], [Object] ],
index: 1,
expected:
{ message: '"することができる"は有害 http://qiita.com/takahi-i/items/a93dc2ff42af6b93f6e0',
tokens: [Object] } } ]
*/
});
Type: Object
Type: Object
tokens
Array<Object> match tokens,index
number index of first match tokenskipped
Array<boolean> skipped values for tokensdict
Array<ExpectedDictionary> dictionary defined by youdictionaries
Array<ExpectedDictionary>Returns morphemeMatchAll
match actualTokens
with dictionaries
Returns Array<MatchResult>
See Releases page.
Install devDependencies and Run npm test
:
npm i -d && npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT © azu
FAQs
A wrapper of morpheme-match API. Match all kuromoji's tokens.
The npm package morpheme-match-all receives a total of 32,580 weekly downloads. As such, morpheme-match-all popularity was classified as popular.
We found that morpheme-match-all demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.